//----------------------------------------------------------------------------
// M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S
//----------------------------------------------------------------------------
// Copyright (C) 2012 - MARIN - All rights reserved - http://www.marin.nl
//----------------------------------------------------------------------------
// Program    : mermaid
// Module     : vbm
// File       : timederivatives.h
// Author     : M.A. de Jong
//----------------------------------------------------------------------------

#ifndef TIMEDERIVATIVES_H
#define TIMEDERIVATIVES_H

#include "kernels/timederivatives_kernels.h"

namespace wavescomputer
{

template <class T>
inline void timederivatives(T* dt_zeta, T* dt_phi,
                            const T* U1, const T* U2,
                            const T* h0, const T* D0,
                            const T* zeta, const T* phi, const T* psi,
                            const T* SRCz, const T* pressurePulse,
                            const T pslow,
                            const int Nx1, const int Nx2,
                            const T dx1, const T dx2,
                            const int cx, const int cy,
                            const int ld,
                            const T g)
{
    dimGrid.x = cx / NUM_THREADS_X;
    dimGrid.y = cy / NUM_THREADS_Y;
    dimBlock.x = NUM_THREADS_X;
    dimBlock.y = NUM_THREADS_Y;

    kernel_timederivatives<T> <<< dimGrid, dimBlock >>> 
        (dt_zeta, dt_phi, 
         U1, U2, 
         h0, D0, 
         zeta, phi, psi,
         SRCz, pressurePulse,
         pslow,
         Nx1, Nx2,
         dx1, dx2,
         ld, g);
    checkCudaError(cudaGetLastError(), "wavescomputer::kernel_timederivatives");
}

} // namespace wavescomputer

#endif // TIMEDERIVATIVES_H

